Pythagorean theorem explained